package com.zy.ServletFilter;

import javax.servlet.*;
import java.io.IOException;

//@WebFilter("/index.jsp") //只有访问index.jsp时过滤器才被执行
public class FilterDemo3 implements Filter
{
    @Override
    public void init(FilterConfig filterConfig) throws ServletException
    {
        System.out.println("init方法被执行----");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
    {
        System.out.println("FilterDemo3被执行----");
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override
    public void destroy()
    {
        System.out.println("destroy方法被执行----");
    }
}
